﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ImageConverter.Model;
using System.IO;

namespace ImageConverter.Utils
{
    public static class FileSearchUtil
    {
        /// <summary>
        /// Non recursively Gets archive items from given path
        /// </summary>
        /// <param name="path"></param>
        /// <param name="extension"></param>
        /// <returns></returns>
        public static IEnumerable<ContainerItem> GetItems(string path, string extension)
        {
            DirectoryInfo dir = new DirectoryInfo(path);

            if (!dir.Exists)
                return new ContainerItem[] { };

            var files = dir.EnumerateFiles(extension);

            return files.Select(fi => new ContainerItem(fi.FullName,false)).ToList();
        }
    }
}
